﻿using MyVideoManager2.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Media;


namespace MyVideoManager2.DataModel.simple
{
    [KnownType(typeof(OM_Dossier))]
    [DataContractAttribute (IsReference=true)]
    class OM_Dossier
    {
        public static List<OM_Dossier> lstDossier = new List<OM_Dossier>();

        public static Dossier transfert(OM_Dossier dossier)
        {
            Dossier nouveauDossier = new Dossier(dossier.nomDossier, dossier.uniqueId, dossier.imagePath, dossier.cheminDossier);

            foreach (OM_Film monFilm in dossier.lstFilms)
            {
                Film nouveauFilm = new Film(monFilm.uniqueId, monFilm.titreFilm, monFilm.realisateurFilm, monFilm.cheminFilm, nouveauDossier, monFilm.genrePrincipal, monFilm.genreSecondaire, monFilm.descriptionFilm, monFilm.anneeSortie, monFilm.anneeSortie, monFilm.titreFilmOriginal);
                nouveauDossier.Items.Add(nouveauFilm);
            }


            return nouveauDossier;
        }

        public OM_Dossier()
        {
        }

        public OM_Dossier(String nomDossier, String uniqueId, String imagePath, String cheminDossier, Peripherique peripherique)
        {
            this.uniqueId = uniqueId;
            this.nomDossier = nomDossier;
            this.imagePath = imagePath;
            this.peripherique = peripherique;
            this.cheminDossier = cheminDossier;

        }

        public OM_Dossier(String nomDossier, String uniqueId, String cheminDossier)
        {
            this.uniqueId = uniqueId;
            this.nomDossier = nomDossier;
            this.imagePath = "";
            this.peripherique = null;
            this.cheminDossier = cheminDossier;
        }

        [DataMember()]
        public string uniqueId { get; set; }

        [DataMember()]
        public string nomDossier { get; set; }

        [DataMember()]
        public string imagePath { get; set; }

        [DataMember()]
        public Peripherique peripherique { get; set; }

        [DataMember()]
        public string cheminDossier { get; set; }

        [DataMember()]
        public List<OM_Film> lstFilms = new List<OM_Film>();



        public List<OM_Film> getLstFilms()
        {
            return this.lstFilms;
        }
    }
}
